import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Solution {
    public int[] twoSum(int[] nums, int target){
        Map<Integer,Integer> hashTable = new HashMap<>();//用于存储Integer类型的键和值，可以快速查找、插入、删除键值对
        for (int i = 0; i < nums.length; i++) {
            if(hashTable.containsKey(target-nums[i])){
                return new int[] {hashTable.get(target-nums[i]),i};
            }
            hashTable.put(nums[i],i);
        }
        return new int[0];
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextInt()){
            int size = scanner.nextInt();
            int[] nums = new int[size];
            for (int i = 0; i < nums.length; i++) {
                nums[i] = scanner.nextInt();
            }
            int target = scanner.nextInt();
            Solution solution = new Solution();
            int[] result = solution.twoSum(nums,target);
            System.out.println(result[0]+","+result[1]);
        }
    }
}